home *** CD-ROM | disk | FTP | other *** search
Text File | 2007-09-27 | 29.9 KB | 1,067 lines |
- function tgt_forward()
- {
- if(!startplay)
- {
- startplay = true;
- }
- var _loc2_ = 0;
- for(var _loc3_ in tgt_mcs)
- {
- if(tgt_mcs[_loc3_]._x > 0 && tgt_mcs[_loc3_]._x < 560)
- {
- if(tgt_mcs[_loc3_]._y > 0 && tgt_mcs[_loc3_]._y < 400)
- {
- _loc2_ = _loc2_ + 1;
- }
- }
- }
- if(_loc2_ < _root["ballRollBackNum" + levelNum] && !setGameLevelStart)
- {
- if(!(EndBall._x > 0 && EndBall._x < 560 && EndBall._y > 0 && EndBall._y < 400) && (String(_root.removeTxName).length == 0 || _root.removeTxName == undefined) && !insert_bool)
- {
- tgt_speed = ballRollBackSpeeds;
- }
- }
- if(tgt_speed > 50 && setGameLevelStart)
- {
- setGameLevelStart = null;
- }
- if(tgt_speed > min_speed)
- {
- if(_loc2_ < _root["rollOutAllBall" + levelNum] - rollAllBallCutNum && tgt_speed > 50)
- {
- tgt_speed -= speed_a;
- }
- else if(_loc2_ >= _root["rollOutAllBall" + levelNum] - rollAllBallCutNum || EndBall._x > 0 && EndBall._x < 560 && EndBall._y > 0 && EndBall._y < 400)
- {
- tgt_speed -= speed_a;
- setGameLevelStart = null;
- }
- }
- else if(tgt_speed < min_speed && tgt_speed > - posXishu and !Allstop)
- {
- tgt_speed += speed_a;
- }
- if(firstBall.pos < -200 && tgt_speed < 100)
- {
- if(!teBrak)
- {
- tgt_speed += Math.round(Math.abs(tgt_speed / 4));
- }
- }
- if(tgt_speed < speed_a * 2)
- {
- }
- if(boom_bool)
- {
- boom_lock_times++;
- if(boom_lock_times >= boom_lock_total)
- {
- boom_bool = false;
- forward_bool = true;
- tgt_speed = min_speed;
- }
- }
- else if(!forward_bool)
- {
- if(forward_num < forward_num_total)
- {
- goback_all_balls();
- forward_num++;
- }
- else
- {
- forward_bool = true;
- tgt_speed = min_speed;
- }
- }
- else if(firstBall)
- {
- push_balls(firstBall,tgt_speed);
- }
- crt_new_ball();
- if(insert_bool)
- {
- tgt_insert_move();
- }
- if(!boom_bool)
- {
- move_break();
- }
- check_fail();
- if(gameTest)
- {
- draw_test_line();
- }
- if(speedCheck)
- {
- speed_listener.showSpeed();
- }
- levelTimes++;
- }
- function crt_new_ball()
- {
- if(tgt_num < tgt_totalNum)
- {
- if(firstBall._name != undefined)
- {
- var _loc1_ = firstBall.pos;
- if(_loc1_ > 0)
- {
- if(tgt_speed < posXishu)
- {
- if(_loc1_ >= posXishu)
- {
- if(_loc1_ < posXishu + tgt_speed)
- {
- firstBall = tgt_push_first(_loc1_ - posXishu,getNewType(firstBall.type),false);
- }
- else
- {
- firstBall = tgt_push_first(0,getNewType(firstBall.type),true);
- }
- }
- }
- else
- {
- firstBall = tgt_push_first(_loc1_ - posXishu,getNewType(firstBall.type),false);
- if(firstBall.pos > posXishu)
- {
- crt_new_ball();
- }
- }
- }
- }
- else
- {
- firstBall = tgt_push_first(0,random(tgt_type) + 1);
- }
- setTgt_bar();
- }
- }
- function tgt_push_first(pos, type, break_bool)
- {
- var _loc2_ = tgt_mcs.attachMovie("targetBall","_t" + tgt_depth,tgt_depth);
- setTag(_loc2_,true);
- if(type == 10)
- {
- type = 1;
- }
- if(_root.blackandom == tgt_num)
- {
- _loc2_.gotoAndStop(9);
- _root.black_ball_mc = _loc2_;
- _loc2_.type = 10;
- randomhei1 = 0;
- }
- else
- {
- _loc2_.gotoAndStop(type);
- _loc2_.type = type;
- }
- if(tgt_num == tgt_totalNum - 1)
- {
- _loc2_.gotoAndStop(11);
- _loc2_.type = 11;
- EndBall = _loc2_;
- }
- _loc2_._x = pos_array[Math.floor(pos / lineXishu)].x;
- _loc2_._y = pos_array[Math.floor(pos / lineXishu)].y;
- if(!flower_show_bool)
- {
- _loc2_.cacheAsBitmap = true;
- _loc2_.flower.roll_mc._visible = false;
- }
- _loc2_.goback_speed = 0;
- _loc2_.goback_speed2 = 0;
- _loc2_.pos = pos;
- _loc2_.depth = tgt_depth;
- _loc2_.removing = false;
- _loc2_.checkTag = true;
- tgt_depth++;
- tgt_num++;
- tgt_same_num++;
- balls_num++;
- type_num_array[type] = type_num_array[type] + 1;
- if(break_bool == false)
- {
- 211;
- _loc2_.right = firstBall;
- _loc2_.left = undefined;
- _loc2_.link_right = undefined;
- _loc2_.link_left = undefined;
- firstBall.left = _loc2_;
- firstBall.link_left = undefined;
- }
- else if(break_bool)
- {
- _loc2_.right = undefined;
- _loc2_.left = undefined;
- _loc2_.link_right = firstBall;
- _loc2_.link_left = undefined;
- firstBall.left = undefined;
- firstBall.link_left = _loc2_;
- }
- else
- {
- _loc2_.right = undefined;
- _loc2_.left = undefined;
- _loc2_.link_right = undefined;
- _loc2_.link_left = undefined;
- }
- return _loc2_;
- }
- function tgt_insert_start(obj, dir)
- {
- teindir_sp = dir;
- insert_times = 0;
- if(dir == "left")
- {
- move_left_ball = obj.left;
- move_right_ball = obj;
- insert_pos = obj.pos - posXishu / 2;
- }
- else if(dir == "right")
- {
- move_left_ball = obj;
- move_right_ball = obj.right;
- insert_pos = obj.pos + posXishu / 2;
- }
- if(spSuperType == 10)
- {
- }
- insert_bool = true;
- }
- function tgt_insert_move()
- {
- if(move_left_ball._name == undefined && move_right_ball._name == undefined)
- {
- ball.holder.removeMovieClip();
- delete ball;
- crt_mc.gotoAndPlay(2);
- insert_bool = false;
- }
- else
- {
- if(move_left_ball._name != undefined && move_right_ball._name != undefined)
- {
- insert_pos = Math.round((move_left_ball.pos + move_right_ball.pos) / 2);
- }
- else if(move_left_ball._name != undefined)
- {
- insert_pos = move_left_ball.pos + posXishu;
- }
- else
- {
- insert_pos = move_right_ball.pos - posXishu;
- }
- var _loc2_ = (pos_array[Math.floor(move_left_ball.pos / lineXishu) + 3].x + pos_array[Math.floor(move_left_ball.pos / lineXishu) + 2].x) / 2;
- var _loc1_ = (pos_array[Math.floor(move_left_ball.pos / lineXishu) + 3].y + pos_array[Math.floor(move_left_ball.pos / lineXishu) + 2].y) / 2;
- var _loc3_ = true;
- ball.holder._x -= (ball.holder._x - _loc2_) / 3;
- ball.holder._y -= (ball.holder._y - _loc1_) / 3;
- if(teindir_sp == "left")
- {
- ball.holder._rotation -= 30;
- }
- else
- {
- ball.holder._rotation += 30;
- }
- insert_times++;
- trace(" kinsert_times = " + insert_times);
- if(insert_times <= insert_total_times)
- {
- push_balls(move_right_ball,insert_step);
- pull_balls(move_left_ball,- insert_step);
- }
- if(insert_times == insert_total_times + 2)
- {
- insert_bool = false;
- tgt_insert_end(insert_type);
- }
- }
- }
- function tgt_insert_end(type)
- {
- crtNewBall();
- ball.holder.removeMovieClip();
- delete ball;
- var _loc3_ = tgt_mcs.attachMovie("targetBall","_ts" + b_depth,b_depth);
- setTag(_loc3_,false);
- _loc3_.gotoAndStop(type);
- _loc3_.type = type;
- if(!flower_show_bool)
- {
- _loc3_.cacheAsBitmap = true;
- _loc3_.flower.roll_mc._visible = false;
- }
- _loc3_.depth = b_depth;
- _loc3_.pos = insert_pos;
- _loc3_.removing = false;
- _loc3_.checkTag = true;
- _loc3_.goback_speed = 0;
- _loc3_.goback_speed2 = 0;
- trace(" carry from tgt_insert_end ");
- updatePos(_loc3_,0,true);
- b_depth++;
- balls_num++;
- type_num_array[type] = type_num_array[type] + 1;
- if(move_left_ball._name != undefined)
- {
- move_right_ball = move_left_ball.right;
- }
- if(move_right_ball._name != undefined)
- {
- move_left_ball = move_right_ball.left;
- }
- if(move_left_ball.removing && move_right_ball.removing)
- {
- balls_num--;
- type_num_array[_loc3_.type];
- myGrid.pop(_loc3_._x,_loc3_._y,_loc3_,"tgt_ball");
- _loc3_.removeMovieClip();
- }
- else
- {
- if(move_left_ball._name != undefined && move_right_ball._name != undefined)
- {
- _loc3_.left = move_left_ball;
- _loc3_.right = move_right_ball;
- _loc3_.link_right = undefined;
- _loc3_.link_left = undefined;
- move_left_ball.right = _loc3_;
- move_left_ball.link_right = undefined;
- move_right_ball.left = _loc3_;
- move_right_ball.link_left = undefined;
- }
- else if(move_left_ball._name == undefined && move_right_ball._name != undefined)
- {
- _loc3_.left = undefined;
- _loc3_.right = move_right_ball;
- _loc3_.link_left = move_right_ball.link_left;
- _loc3_.link_right = undefined;
- move_right_ball.link_left.link_right = _loc3_;
- move_right_ball.left = _loc3_;
- move_right_ball.link_left = undefined;
- if(move_right_ball == firstBall)
- {
- firstBall = _loc3_;
- }
- else
- {
- if(_loc3_.type == _loc3_.link_left.type)
- {
- _loc3_.goback_speed = init_goback_speed;
- }
- else
- {
- _loc3_.goback_speed = 0;
- }
- break_array_pop(move_right_ball);
- break_array.push(_loc3_);
- }
- }
- else if(move_left_ball._name != undefined && move_right_ball._name == undefined)
- {
- _loc3_.left = move_left_ball;
- _loc3_.right = undefined;
- _loc3_.link_left = undefined;
- _loc3_.link_right = move_left_ball.link_right;
- move_left_ball.link_right.link_left = _loc3_;
- move_left_ball.right = _loc3_;
- move_left_ball.link_right = undefined;
- }
- else
- {
- balls_num--;
- type_num_array[_loc3_.type]--;
- myGrid.pop(_loc3_._x,_loc3_._y,_loc3_,"tgt_ball");
- _loc3_.removeMovieClip();
- }
- if(_loc3_.pos != undefined)
- {
- if(_loc3_.right._name != undefined)
- {
- align_left_balls(_loc3_.right);
- }
- if(_loc3_.left._name != undefined)
- {
- align_right_balls(_loc3_.left);
- }
- if(insert_type == 7)
- {
- this.attachMovie("sp1","sp1",this.getNextHighestDepth(),{_x:_loc3_._x,_y:_loc3_._y});
- _loc3_.type = 10;
- checkRemove(_loc3_,0);
- subtract();
- teBrak = 1;
- forward_bool = false;
- forward_num = -10;
- goback_all_balls();
- PropUse = false;
- }
- else if(insert_type == 8)
- {
- _loc3_.type = 10;
- checkRemove(_loc3_,0);
- subtract();
- }
- else if(insert_type == 9)
- {
- this.attachMovie("sp2","sp2",this.getNextHighestDepth(),{_x:_loc3_._x,_y:_loc3_._y});
- _loc3_.type = 10;
- checkRemove(_loc3_,0);
- subtract();
- var teConte = 100;
- this.onEnterFrame = function()
- {
- Allstop = true;
- teConte--;
- if(!teConte)
- {
- Allstop = false;
- delete this.onEnterFrame;
- }
- };
- PropUse = false;
- }
- if(_root.holdBall)
- {
- checkRemove(_loc3_,0);
- subtract();
- }
- if(_root.jumpBall)
- {
- checkRemove(_loc3_,0);
- }
- else
- {
- checkRemove(_loc3_,initCanRemoveNum);
- }
- }
- }
- }
- function checkRemove(obj, CanRemoveNum)
- {
- trace(" obj = " + obj + " CanRemoveNum = " + CanRemoveNum);
- var _loc3_ = [obj];
- var _loc5_ = obj.right;
- var _loc4_ = obj.left;
- var _loc14_ = _loc5_.right;
- var _loc12_ = _loc4_.left;
- if(_root.jumpBall)
- {
- if(_root.ooo > 0)
- {
- _loc3_.unshift(_loc4_);
- }
- }
- else
- {
- while(_loc5_._name != undefined && obj.type == _loc5_.type && !_loc5_.removing)
- {
- _loc3_.push(_loc5_);
- _loc5_ = _loc5_.right;
- }
- while(_loc4_._name != undefined && obj.type == _loc4_.type && !_loc4_.removing)
- {
- _loc3_.unshift(_loc4_);
- _loc4_ = _loc4_.left;
- }
- }
- if(_root.ooo)
- {
- _loc3_.shift();
- }
- if(_loc3_.length > CanRemoveNum)
- {
- sp_xiqiu = true;
- var _loc7_ = new Object();
- _loc7_.tgt_remove_num = 0;
- _loc7_.id = random(65535);
- _loc7_.remove_array = _loc3_;
- remove_arr_array[_loc7_.id] = _loc7_;
- remove_sound.start(0);
- i = 0;
- while(i < _loc3_.length)
- {
- _loc3_[i].remove_id = _loc7_.id;
- myGrid.pop(_loc3_[i]._x,_loc3_[i]._y,_loc3_[i],"tgt_ball");
- _loc3_[i].removing = true;
- _loc3_[i].gotoAndPlay("remove");
- i++;
- }
- trace(" myGrid = " + myGrid);
- if(_root.ball == undefined)
- {
- _root.crtNewBall();
- if(_root.holdBall)
- {
- _root.holdBall = false;
- holdBall_mc.attachMovie("hold_mc","hold_mc",this.getDepth() + 1);
- holdBall_mc.hold_mc._x = hold_mx.x;
- holdBall_mc.hold_mc._y = hold_mx.y;
- }
- }
- }
- else
- {
- maxcomboTE = 0;
- }
- _root.number_num = _root.number_num + 1;
- if(_root.jumpBall)
- {
- _root.ooo = _root.ooo + 1;
- if(_root.ooo < 6 && _loc4_.left != _root.EndBall && _loc4_.left != undefined && _loc4_.left != firstBall)
- {
- checkRemove(_loc4_.left,0);
- subtract();
- }
- else
- {
- _root.ooo = 0;
- _root.jumpBall = false;
- }
- }
- trace("PowerMC.hong._x" + PowerMC.hong._x + "PowerMC.hong2._x" + PowerMC.hong._x + "=====");
- if(PowerMC.hong._x >= -6)
- {
- PowerMC.hong._x = -110;
- PowerMC.hong2._x = -110;
- }
- var _loc9_ = _root.unblack == undefined;
- var _loc10_ = _root.black_ball_mc != undefined && _root.black_ball_mc != "";
- var _loc11_ = _root.black_ball_mc.left._currentframe >= 13 && _root.black_ball_mc.left._currentframe != undefined || _root.black_ball_mc.left == undefined;
- var _loc8_ = _root.black_ball_mc.right._currentframe >= 13 && _root.black_ball_mc.right._currentframe != undefined || _root.black_ball_mc.right == undefined;
- trace([_loc9_,_loc10_,_loc11_,_loc8_,_root.black_ball_mc]);
- if(_loc9_ && _loc10_ && _loc11_ && _loc8_ && String(_root.black_ball_mc).length != 0)
- {
- trace("-------------------------------: remove the black ball:" + _root.black_ball_mc);
- _root.unblack = 1;
- checkRemove(_root.black_ball_mc,0);
- delete _root.unblack;
- }
- }
- function remove_movie_end(id)
- {
- if(remove_arr_array[id].remove_array.length > remove_arr_array[id].tgt_remove_num + 1)
- {
- remove_arr_array[id].tgt_remove_num = remove_arr_array[id].tgt_remove_num + 1;
- }
- else
- {
- remove_ball(id);
- }
- }
- function remove_one(obj)
- {
- var _loc1_ = new Object();
- _loc1_.tgt_remove_num = 0;
- _loc1_.id = random(65535);
- _loc1_.remove_array = [obj];
- remove_arr_array[_loc1_.id] = _loc1_;
- obj.remove_id = _loc1_.id;
- obj.gotoAndPlay("remove_one");
- obj.removing = true;
- myGrid.pop(obj._x,obj._y,obj,"tgt_ball");
- }
- function remove_ball(id)
- {
- var _loc3_ = remove_arr_array[id].remove_array;
- delete remove_arr_array[id];
- var _loc12_ = _loc3_[0];
- var _loc11_ = _loc3_[_loc3_.length - 1];
- var _loc10_ = _loc12_.left;
- var _loc9_ = _loc11_.right;
- if(_loc10_._name == undefined && _loc9_._name == undefined)
- {
- _loc12_.link_left.link_right = _loc11_.link_right;
- _loc11_.link_right.link_left = _loc12_.link_left;
- if(_loc12_ == firstBall)
- {
- firstBall = _loc11_.link_right;
- }
- }
- else if(_loc10_._name == undefined)
- {
- _loc9_.left = undefined;
- _loc9_.link_left = _loc12_.link_left;
- _loc9_.link_left.link_right = _loc9_;
- if(_loc12_ == firstBall)
- {
- firstBall = _loc9_;
- }
- }
- else if(_loc9_._name == undefined)
- {
- _loc10_.right = undefined;
- _loc10_.link_right = _loc11_.link_right;
- _loc10_.link_right.link_left = _loc10_;
- }
- else
- {
- _loc10_.right = undefined;
- _loc9_.left = undefined;
- _loc10_.link_right = _loc9_;
- _loc9_.link_left = _loc10_;
- }
- trace(goal * _loc3_.length + "==AA==");
- setGoal(int(goal * _loc3_.length));
- var _loc13_ = _root.attachMovie("appearPoint","appearPoint" + _root.getNextHighestDepth(),_root.getNextHighestDepth());
- _loc13_._x = _loc11_._x;
- _loc13_._y = _loc11_._y;
- _loc13_.addItemPoint = goal * _loc3_.length;
- getPower();
- if(comboPD)
- {
- maxcombonumTE += _loc3_.length;
- if(sp_xiqiu)
- {
- combotol++;
- maxcomboTE++;
- }
- if(maxcomboTE > 0)
- {
- if(!combo)
- {
- _root.attachMovie("combo","combo",10000);
- combo._x = _loc13_._x;
- combo._y = _loc13_._y;
- }
- else
- {
- combo.gotoAndPlay("disp");
- }
- setGoal(100 * combotol);
- }
- comboPD = false;
- }
- else
- {
- maxcomboTE = 0;
- maxcombonumTE = _loc3_.length;
- }
- if(maxcomboTE > maxcombo)
- {
- maxcombo = maxcomboTE;
- }
- if(maxcombonumTE > maxcombonum)
- {
- maxcombonum = maxcombonumTE;
- }
- i = 0;
- while(i < _loc3_.length)
- {
- if(_loc3_[i].checkTag)
- {
- if(_loc3_[i].tag == "bo")
- {
- var _loc6_ = _loc3_[i].idnum;
- var _loc5_ = _root.attachMovie("showTebieCartoon","showTebieCartoon" + _root.getNextHighestDepth(),_root.getNextHighestDepth());
- _loc5_._x = _loc3_[i]._x;
- _loc5_._y = _loc3_[i]._y;
- _loc5_.pic.gotoAndStop(_loc6_);
- var _loc2_ = 0;
- while(_loc2_ < cha_arr.length)
- {
- if(_loc6_ == cha_arr[_loc2_] && cha_arr2[_loc2_] != 1)
- {
- if(cha_arr[_loc2_] == "h")
- {
- _root.poop1.gotoAndStop(2);
- }
- else if(cha_arr[_loc2_] == "o")
- {
- _root.poop2.gotoAndStop(3);
- }
- else if(cha_arr[_loc2_] == "n")
- {
- _root.poop3.gotoAndStop(4);
- }
- else if(cha_arr[_loc2_] == "e")
- {
- _root.poop4.gotoAndStop(5);
- }
- else if(cha_arr[_loc2_] == "y")
- {
- _root.poop5.gotoAndStop(6);
- }
- cha_arr.splice(_loc2_,1);
- cha_arr2.splice(_loc2_,1);
- cha_has++;
- }
- if(cha_has >= 5)
- {
- cha_has = 0;
- cha_arr = ["h","o","n","e","y"];
- cha_arr2 = [0,0,0,0,0];
- re_back_func_();
- _root.attachMovie("movieClassMC","movieClassMC" + _root.getNextHighestDepth(),_root.getNextHighestDepth(),{_x:158,_y:172});
- next_leve_func();
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- if(_loc3_[i].tag == "dir")
- {
- trace(_loc3_[i].tag);
- dir_bool = true;
- dir_num = 0;
- dir_sound.start(0);
- var _loc4_ = random(255);
- tags_mc.attachMovie("dirs_mc","tags" + _loc4_,_loc4_);
- tags_mc["tags" + _loc4_]._x = _loc3_[i]._x;
- tags_mc["tags" + _loc4_]._y = _loc3_[i]._y;
- }
- else if(insert_type == 8)
- {
- boom_bool = true;
- boom_lock_times = 0;
- ball_boom(_loc3_[i]);
- boom_sound.start(0);
- _loc4_ = random(255);
- tags_mc.attachMovie("booms","tags" + _loc4_,_loc4_);
- tags_mc["tags" + _loc4_]._x = _loc3_[i]._x;
- tags_mc["tags" + _loc4_]._y = _loc3_[i]._y;
- }
- }
- balls_num--;
- type_num_array[_loc3_[i].type]--;
- _loc3_[i].removeMovieClip();
- i++;
- }
- if(_loc9_._name != undefined)
- {
- if(_loc9_.type == _loc9_.link_left.type)
- {
- comboPD = true;
- _loc9_.goback_speed = init_goback_speed;
- }
- else
- {
- _loc9_.goback_speed = 0;
- }
- break_array.push(_loc9_);
- sp_xiqiu = false;
- }
- }
- function cheangball()
- {
- if(tgt_num >= tgt_totalNum && balls_num < 25)
- {
- while(type_num_array[ball.type] == 0 && balls_num != 0 && !superBall)
- {
- ball.type = random(tgt_type) + 1;
- ball.holder.gotoAndStop(ball.type);
- center_mc.nextBall2.type = ball.type;
- center_mc.nextBall.type = ball.type;
- center_mc.nextBall.gotoAndStop(ball.type);
- center_mc.nextBall2.gotoAndStop(ball.type);
- }
- }
- }
- function cheangballHS()
- {
- if(ball)
- {
- var _loc1_ = ball.type;
- tmp0_type = tmp_ball_ball_type_arr[0];
- tmp1_type = tmp_ball_ball_type_arr[1];
- tmp2_type = tmp_ball_ball_type_arr[2];
- tmp_ball_ball_type_arr[0] = tmp2_type;
- tmp_ball_ball_type_arr[1] = tmp0_type;
- tmp_ball_ball_type_arr[2] = tmp1_type;
- ball_type_change = true;
- ball.holder.gotoAndStop(tmp_ball_ball_type_arr[0]);
- center_mc.nextBall.gotoAndStop(tmp_ball_ball_type_arr[1]);
- center_mc.nextBall2.gotoAndStop(tmp_ball_ball_type_arr[2]);
- }
- }
- function move_break()
- {
- var _loc2_ = undefined;
- i = 0;
- while(i < break_array.length)
- {
- _loc2_ = break_array[i];
- if(_loc2_.link_left._name != undefined)
- {
- var _loc4_ = undefined;
- if(_loc2_.type != _loc2_.link_left.type)
- {
- _loc4_ = posXishu;
- }
- else
- {
- _loc4_ = posXishu - _loc2_.goback_speed;
- }
- if(mcDistance2(_loc2_,_loc2_.link_left) <= _loc4_)
- {
- var _loc3_ = find_break_ball(_loc2_.link_left);
- if(_loc3_ == firstBall)
- {
- if(_loc2_.goback_speed2 == 0)
- {
- tgt_speed += Math.round(_loc2_.goback_speed * 0.6);
- }
- else
- {
- tgt_speed += Math.round(_loc2_.goback_speed2 * 0.8);
- }
- tgt_speed = Math.max(tgt_speed,max_goback_speed);
- }
- else if(_loc2_.goback_speed2 == 0)
- {
- _loc3_.goback_speed2 = Math.round(_loc2_.goback_speed * 0.8);
- }
- else
- {
- _loc3_.goback_speed2 = Math.round(_loc2_.goback_speed2 * 0.8);
- }
- _loc2_.goback_speed = 0;
- _loc2_.goback_speed2 = 0;
- attach_sound.start(0);
- break_array_pop(_loc2_);
- _loc2_.left = _loc2_.link_left;
- _loc2_.left.right = _loc2_;
- _loc2_.link_left = undefined;
- _loc2_.left.link_right = undefined;
- if(_loc2_.type == _loc2_.left.type && _root.jumpBall != true)
- {
- checkRemove(_loc2_,initCanRemoveNum);
- }
- while(_loc2_._name != undefined)
- {
- _loc2_.pos = _loc2_.left.pos + posXishu;
- _loc2_ = _loc2_.right;
- }
- }
- else if(_loc2_.type == _loc2_.link_left.type)
- {
- push_balls(_loc2_,_loc2_.goback_speed);
- _loc2_.goback_speed += init_goback_speed * 0.8;
- _loc2_.goback_speed = Math.max((- posXishu) * 1.2,_loc2_.goback_speed);
- }
- else if(_loc2_.goback_speed2 < 0)
- {
- push_balls(_loc2_,_loc2_.goback_speed2);
- _loc2_.goback_speed2 += 5;
- }
- }
- i++;
- }
- }
- function check_break(obj)
- {
- if(obj.pos > 0 && obj.pos < pos_array.length * posXishu)
- {
- if(obj.link_left._name != undefined)
- {
- if(mcDistance2(obj,obj.link_left) <= posXishu)
- {
- obj.left = obj.link_left;
- obj.left.right = obj;
- obj.link_left = undefined;
- obj.left.link_right = undefined;
- break_array_pop(obj);
- align_right_balls(ball2);
- }
- }
- if(obj.link_right._name != undefined)
- {
- if(mcDistance2(obj,obj.link_right) <= posXishu)
- {
- obj.right = obj.link_right;
- obj.right.left = obj;
- obj.link_right = undefined;
- obj.right.link_left = undefined;
- break_array_pop(obj);
- align_left_balls(ball2);
- }
- }
- }
- }
- function lost_func2()
- {
- lost_game_blo = false;
- _level0.BOX_x.unloadMovie();
- delete _root.BAllID;
- delete move_listener_mc.onEnterFrame;
- setLife(-1);
- dir_mc.clear();
- failMovie_mc.gotoAndPlay(3);
- }
- function check_fail()
- {
- find_last();
- if(last_pos > pos_array.length * lineXishu && !last_ball.removing)
- {
- holdBall_mc.hold_mc.unloadMovie();
- hold_mx.num = 0;
- delete _root.holdBall;
- _root.holdBall2 == false;
- if(!gameOver)
- {
- _level0.BOX_x.unloadMovie();
- delete _root.BAllID;
- gameZT = "失败";
- tgt_speed = 160;
- min_speed = -10000;
- tgt_totalNum = 0;
- speed_a *= -1;
- gameOver = true;
- a;
- m_lock = true;
- clearBall();
- bg_sound.stop();
- create_lost_Sound();
- }
- if(_root.EndBall == firstBall || balls_num < 2 || lost_game_blo)
- {
- lost_game_blo = false;
- _level0.BOX_x.unloadMovie();
- delete _root.BAllID;
- delete move_listener_mc.onEnterFrame;
- trace("载入失败动画 ");
- lost_func2();
- bg_sound.stop();
- }
- last_ball.left.right = undefined;
- balls_num--;
- type_num_array[last_ball.type]--;
- myGrid.pop(last_ball._x,last_ball._y,last_ball,"tgt_ball");
- last_ball.removeMovieClip();
- }
- else if(balls_num <= 2 && _root.ball_number_n == 0 && _root.EndBall != undefined && String(typeof _root.EndBall.length > 0) && _root.EndBall.right == undefined && _root.EndBall.left == undefined)
- {
- if(balls_num == 2)
- {
- var _loc2_ = [];
- for(var _loc3_ in _level0.tgt_mcs)
- {
- _loc2_.push(_level0.tgt_mcs[_loc3_]);
- if(_loc3_.substr(2,1) == "s")
- {
- _level0.BOX_x.unloadMovie();
- next_leve_func();
- trace("+++++++++++++++++++++++++++++++++++");
- break;
- }
- }
- if(_root.dis_func(_loc2_[0],_loc2_[1]) < 15)
- {
- _level0.BOX_x.unloadMovie();
- delete _root.BAllID;
- gameZT = "失败";
- tgt_speed = 160;
- min_speed = -10000;
- tgt_totalNum = 0;
- speed_a *= -1;
- gameOver = true;
- a;
- m_lock = true;
- clearBall();
- }
- }
- else if(balls_num == 1)
- {
- _level0.BOX_x.unloadMovie();
- next_leve_func();
- trace("--------------------------------------------------------------------------");
- }
- }
- else if(balls_num <= 2 && _root.ball_number_n == 0 && _root.EndBall.right._currentframe == 9)
- {
- holdBall_mc.hold_mc.unloadMovie();
- hold_mx.num = 0;
- delete _root.holdBall;
- _root.holdBall2 == false;
- if(balls_num <= 1 && _root.EndBall.right._currentframe == 9)
- {
- _level0.BOX_x.unloadMovie();
- delete _root.BAllID;
- next_leve_func();
- }
- else if(balls_num == 2 && _root.EndBall.right._currentframe == 9 && String(_root.EndBall).length != 0)
- {
- _level0.BOX_x.unloadMovie();
- delete _root.BAllID;
- next_leve_func();
- }
- }
- else if((last_ball._name == undefined && firstBall._name == undefined or balls_num == 1 and firstBall._name == EndBall._name) && tgt_num >= tgt_totalNum - 1)
- {
- holdBall_mc.hold_mc.unloadMovie();
- hold_mx.num = 0;
- delete _root.holdBall;
- _root.holdBall2 == false;
- _level0.BOX_x.unloadMovie();
- delete _root.BAllID;
- gameZT = "过关";
- win_sound_.start();
- delete move_listener_mc.onEnterFrame;
- superBall = false;
- m_lock = true;
- clearBall();
- dir_mc.clear();
- trace("clear ball " + ball);
- mouth.TX.play();
- move_listener_mc.onEnterFrame = function()
- {
- if(!game_pause)
- {
- winMove();
- }
- };
- var _loc4_ = 0;
- cha_arr = ["h","o","n","e","y"];
- cha_arr2 = [0,0,0,0,0];
- }
- lastBlackBall();
- }
- function getPower()
- {
- if(PowerNum >= 10)
- {
- return undefined;
- }
- PowerNum++;
- if(boom_num > 0)
- {
- boom_num--;
- PowerNum--;
- if(PowerMC.hong._x < -6)
- {
- PowerMC.hong._x -= -6;
- PowerMC.hong2._x -= -6;
- }
- }
- if(PowerMC.hong._x < -6)
- {
- PowerMC.hong._x += PowerStup;
- PowerMC.hong2._x += PowerStup;
- }
- }
- function subtract()
- {
- PowerNum--;
- if(PowerMC.hong._x < -6)
- {
- PowerMC.hong._x -= PowerStup;
- PowerMC.hong2._x -= PowerStup;
- }
- }
- var EndBall;
- var teindir_sp;
- _root.ooo = 0;
- var sp_xiqiu = false;
- if(dd)
- {
- _root.black_ball_mc._visible = false;
- checkRemove(_root.black_ball_mc,0);
- }
- var PowerStup = 12;
- var PowerNum = 0;
-